package teamGiga.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import teamGiga.bean.TheaterBean;
import teamGiga.dao.MovieDao;
import action.servlet.ActionForWard;

public class InsertTheaterAction extends Action{
	private String path;
	private boolean redirect;

	public InsertTheaterAction() {
		super();
	}
	public InsertTheaterAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}
	
	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
			String tname=request.getParameter("tname");
			String taddress=request.getParameter("taddress");
		try {
			TheaterBean tbean=new TheaterBean(0, tname, taddress);
			MovieDao.insertTheater(tbean);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return new ActionForWard(path, redirect);
	}
}
